<template>
  <div>
    <!-- 面包屑 -->
    <el-bread></el-bread>
    <!-- 添加按钮 -->
    <el-button @click="add" class="btn" type="primary" size="small" plain>添加</el-button>
    <!-- 列表渲染 -->
    <v-list @edit="edit"></v-list>
    <!-- 弹框 -->
    <v-dialog ref="diaInfo" @cancel="cancel" 
    :dialogInfo='dialogInfo'></v-dialog>
  </div>
</template>

<script>
import vList from './list.vue'
import vDialog from './dialog.vue'
export default {
  data() {
    return {
        dialogInfo:{
            isShow:false,
            isAdd:true
        }
    };
  },
  methods:{
      //添加打开弹窗
      add(){
          this.dialogInfo.isShow = true,
          this.dialogInfo.isAdd = true
      },
      //编辑打开弹窗
      edit(e){
          this.dialogInfo.isShow = true,
          this.dialogInfo.isAdd = false,
          //打开弹窗并查询
          this.$refs.diaInfo.lookup(e)
      },
      //关闭弹窗
      cancel(e){
          this.dialogInfo.isShow = e
      }
  },
  components:{
      vList,
      vDialog
  }
};
</script>

<style scoped>
.btn{
    margin:10px;
}
</style>
